#include "NSConnectionImpl.h"

NSConnectionImpl::NSConnectionImpl()
{
    pURLDownloadConnection = [[URLDownloadConnection alloc] init];
}

NSConnectionImpl::NSConnectionImpl(const NSConnectionImpl& ins)
{}

std::string NSConnectionImpl::GetData(std::string reqURL)
{
    NSString *requestURL = [[NSString alloc] initWithCString:reqURL.c_str() encoding:NSUTF8StringEncoding];
    NSString * dataValue = [pURLDownloadConnection DownloadData:requestURL];
    std::string data = [dataValue UTF8String];
    return data;
}

extern "C" NetConnection* getNetConnection()
{
    NetConnection* netConnection = new NSConnectionImpl();
    return netConnection;
}